<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title></title>
    <style>
      /* .box1{
        width: 100px;
        height: 100px;
        background: green;
        transition: all 1s;
      }
      .box1:hover{
        width: 200px;
      } */
      .box1{
        width: 100px;
        height: 100px;
        background: green;
      }
      /* 6个状态对应6个类 */
      /* .v-enter{
        opacity: 0;
        transform: translateX(200px);
      }
      .v-enter-active{
        transition: all 2s;
      }
      .v-enter-to{
        opacity: 1;
        transform: none;
      }
      .v-leave{
        opacity: 1;
        transform: none;
      }
      .v-leave-active{
        transition: all 2s;
      }
      .v-leave-to{
        opacity: 0;
        transform: translateX(200px);
      } */
      .v-enter,.v-leave-to{
        opacity: 0;
        transform: translateX(200px);
      }
      .v-enter-active,.v-leave-active{
        transition: all 2s;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <button @click="isShow=true">进入</button>
      <button @click="isShow=false">离开</button>
      <transition>
        <!-- 从右侧200px的位置淡入进来 -->
        <!-- 慢慢的淡出到右侧200px位置 -->
        <div class="box1" v-if="isShow"></div>
      </transition>
    </div>
    <script src="./vue.js"></script>
    <script>
      const vm = new Vue({
        el: '#app',
        data: {
          isShow: true
        }
      })
    </script>
  </body>
</html>